MAX = 1000000

def isP(ss):
    if ss < MAX and isPrime[ss]:
        return True
    return False

isPrime = [1 for i in xrange(MAX+1)]
p = [0]

for i in xrange(2, MAX + 1):
    if isPrime[i]:
        p.append(i)
        for j in xrange(i + i, MAX + 1, i):
            isPrime[j] = 0

n  = len(p)
s = [0 for i in xrange(n)]
for i in xrange(n-1):
    s[i + 1] = s[i] + p[i+1]


for ans in xrange(n, 0, -1):
    if ans % 100 == 0:
        print ans
    for i in xrange(1, n - ans + 1):
        ss = s[i + ans - 1] - s[i]
        if ss >= MAX:
            break
        if isP(ss):
            print i, ans, ss
            exit()

